<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    

    <title>喜马拉雅WiFi音响绑定及通讯协议初稿 | uuxia</title>
    <meta name="author" content="uuxia">
    
    <meta name="description" content="在浮躁的世界安安静静地敲代码">
    
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <meta property="og:title" content="喜马拉雅WiFi音响绑定及通讯协议初稿"/>
    <meta property="og:site_name" content="uuxia的技术博客"/>

    
    <meta property="og:image" content=""/>
    

    <link rel="icon" type="image/png" href="/favicon.png">
    <link rel="alternate" href="/atom.xml" title="uuxia的技术博客" type="application/atom+xml">
    <link rel="stylesheet" href="/css/lib/materialize.min.css">
    <link rel="stylesheet" href="/css/lib/font-awesome.min.css">
    <link rel="stylesheet" href="/css/style.css" media="screen" type="text/css">

    
        <link rel="stylesheet" href="/css/lib/prettify-tomorrow-night-eighties.css" type="text/css">
    
    <!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>


<body>
    <img src="/weixin_favicon.png" style="position: absolute; left: -9999px; opacity: 0; filter: alpha(opacity=0);">

    <nav class="indigo">
    <div class="nav-wrapper">
        <a href="#" data-activates="main-menu" class="button-collapse">
            <i class="fa fa-navicon"></i>
        </a>
        <div class="">
            <a href="/" class="brand-logo hide-on-med-and-down">uuxia的技术博客</a>
            <ul class="right hide-on-med-and-down">
                
                    <li>
                        <a class="menu-home " href="/" >
                            <i class="fa fa-home "></i>
                            
                            首页
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-archive " href="/archives" >
                            <i class="fa fa-archive "></i>
                            
                            归档
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-category category-menu" href="javascript:;" data-activates="category-menu" >
                            <i class="fa fa-bookmark "></i>
                            
                            分类
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-reading " href="/reading" >
                            <i class="fa fa-book "></i>
                            
                            读书
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-about " href="/about" >
                            <i class="fa fa-user "></i>
                            
                            关于
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-search modal-trigger " href="#search" >
                            <i class="fa fa-search "></i>
                            
                            搜索
                        </a>
                    </li>
                
            </ul>
            <div>
    <ul class="side-nav indigo darken-1" id="main-menu">
        
        <li class="side-user">
            <div class="row">
                <div class="col s4 no-padding">
                    <img class="avatar-image circle responsive-img" src="http://uuxia.cn/image/icon.png" alt="User Avatar">
                </div>
                <div class="info col s8 valign-wrapper no-padding">
                    <div class="valign">
                        <p class="name">uuxia</p>
                        <p class="desc">前端/Android/Java/C++/技术宅</p>
                    </div>
                </div>
            </div>
        </li>
        

        
            <li class="no-padding">
                <a class="waves-effect menu-home " href="/" >
                    <i class="fa fa-home "></i>
                    
                    首页
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-archive " href="/archives" >
                    <i class="fa fa-archive "></i>
                    
                    归档
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-category category-menu" href="javascript:;" data-activates="category-menu" >
                    <i class="fa fa-bookmark "></i>
                    
                    分类
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-reading " href="/reading" >
                    <i class="fa fa-book "></i>
                    
                    读书
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-about " href="/about" >
                    <i class="fa fa-user "></i>
                    
                    关于
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-search modal-trigger " href="#search" >
                    <i class="fa fa-search "></i>
                    
                    搜索
                </a>
            </li>
        
    </ul>

    <ul class="side-nav indigo darken-1" id="category-menu">
    

            

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/翻墙/">
                    翻墙 <span class="right">2 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/NDK/">
                    NDK <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/vpn/">
                    vpn <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/Java/">
                    Java <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/Service/">
                    Service <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/生活/">
                    生活 <span class="right">3 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/IoT/">
                    IoT <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/ios/">
                    ios <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/android/">
                    android <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/智能家居/">
                    智能家居 <span class="right">2 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/迅雷/">
                    迅雷 <span class="right">1 篇</span></a>
                </a>
            </li>

        

    </ul>
</div>

        </div>
    </div>
</nav>

<div id="search" class="modal search-modal">
    <div class="row">
        <div class="input-field col s12">
              <input id="search-input" type="text">
              <label for="search-input">搜索</label>
        </div>

    </div>
    <div id="search-result" class="search-result col s12">

    </div>
</div>


    <main>
        <!--add by uuxia 20180402 内容页面的宽度改变-->
<div class="container main-container1">
    <nav class="page-nav hide-on-small-only">
    <div class="nav-wrapper indigo">
        <span class="breadcrumb">当前位置（分类目录）</span>
        
            
    
    
    <a class="breadcrumb" href="/categories/智能家居/">智能家居</a>


        

        
    </div>
</nav>

<article>
    <div class="card">
        <div class="card-content">
            

            <div class="article-title">
                
    
        <h1>喜马拉雅WiFi音响绑定及通讯协议初稿</h1>
    


            </div>
            <time class="pink-link-context" datetime="2016-05-11T22:54:48.000Z"><a href="/2016/05/11/ximalaya/">2016-05-11</a></time>

            <span id="busuanzi_container_page_pv" class="read-times-container">
    <i class="fa fa-eye"></i>
    <span id="busuanzi_value_page_pv"></span>
</span>

            
    <div class="tags-row">
        
            <a href="/tags/Andorid/" class="chip pink lighten-1">Andorid</a>
        
            <a href="/tags/智能家居/" class="chip pink lighten-1">智能家居</a>
        
            <a href="/tags/喜马拉雅/" class="chip pink lighten-1">喜马拉雅</a>
        
    </div>


            <div class="toc pink-link-context hide-on-med-and-down">
    <ol class="section table-of-contents"><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#通讯协议"><span class="section table-of-contents-text">通讯协议</span></a></li><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#通讯Json格式："><span class="section table-of-contents-text">通讯Json格式：</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#参数说明"><span class="section table-of-contents-text">参数说明</span></a></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#全局命令码"><span class="section table-of-contents-text">全局命令码</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-4"><a class="section table-of-contents-link" href="#全局命令码说明如下："><span class="section table-of-contents-text">全局命令码说明如下：</span></a></li></ol></li></ol></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#全局返回码"><span class="section table-of-contents-text">全局返回码</span></a></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#示例"><span class="section table-of-contents-text">示例</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#字符串"><span class="section table-of-contents-text">字符串</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#整形参数"><span class="section table-of-contents-text">整形参数</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#对象"><span class="section table-of-contents-text">对象</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#数组"><span class="section table-of-contents-text">数组</span></a></li></ol></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#指令说明"><span class="section table-of-contents-text">指令说明</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#一、设备基础指令"><span class="section table-of-contents-text">一、设备基础指令</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#二、App主动控制终端指令"><span class="section table-of-contents-text">二、App主动控制终端指令</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#三、终端主动发送控制数据给App"><span class="section table-of-contents-text">三、终端主动发送控制数据给App</span></a></li></ol></li></ol></li><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#音箱数据模型"><span class="section table-of-contents-text">音箱数据模型</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#一、歌单"><span class="section table-of-contents-text">一、歌单</span></a></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#二、播放状态"><span class="section table-of-contents-text">二、播放状态</span></a></li></ol></li><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#绑定流程"><span class="section table-of-contents-text">绑定流程</span></a></li></ol>
</div>


            <div class="entry pink-link-context">
                <p>喜马拉雅WiFi音响绑定及通讯协议初稿<br><a id="more"></a></p>
<h1 id="通讯协议"><a href="#通讯协议" class="headerlink" title="通讯协议"></a><strong>通讯协议</strong></h1><table>
<thead>
<tr>
<th>0x5A</th>
<th style="text-align:center">数据长度</th>
<th>框架版本</th>
<th>协议类型</th>
<th>设备编码</th>
<th>Mac地址</th>
<th>数据帧序列号</th>
<th>保留字</th>
<th>数据类型</th>
<th>数据内容</th>
<th>检验码FCS</th>
</tr>
</thead>
<tbody>
<tr>
<td>1字节</td>
<td style="text-align:center">2字节</td>
<td>1字节</td>
<td>1字节</td>
<td>8字节</td>
<td>6字节</td>
<td>4字节</td>
<td>8字节</td>
<td>2字节</td>
<td>N字节</td>
<td>2字节</td>
</tr>
</tbody>
</table>
<h1 id="通讯Json格式："><a href="#通讯Json格式：" class="headerlink" title="通讯Json格式："></a><strong>通讯Json格式</strong>：</h1><pre><code>{ 
 &quot;cmd&quot;: 0 ,//命令码
&quot;code&quot;: 0,    //返回码
&quot;msg&quot;: &quot;&quot;,    //状态消息
&quot;data&quot;: ......    //数据节点
}
</code></pre><h2 id="参数说明"><a href="#参数说明" class="headerlink" title="参数说明"></a><strong>参数说明</strong></h2><table>
<thead>
<tr>
<th style="text-align:left">参数名称</th>
<th style="text-align:left">是否必须</th>
<th style="text-align:left">字段类型</th>
<th style="text-align:left">参数说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">cmd</td>
<td style="text-align:left">YES</td>
<td style="text-align:left">int</td>
<td style="text-align:left">命令码</td>
</tr>
<tr>
<td style="text-align:left">code</td>
<td style="text-align:left">NO</td>
<td style="text-align:left">int</td>
<td style="text-align:left">返回码</td>
</tr>
<tr>
<td style="text-align:left">msg</td>
<td style="text-align:left">NO</td>
<td style="text-align:left">String</td>
<td style="text-align:left">状态消息</td>
</tr>
<tr>
<td style="text-align:left">data</td>
<td style="text-align:left">NO</td>
<td style="text-align:left">String</td>
<td style="text-align:left">数据节点</td>
</tr>
</tbody>
</table>
<h2 id="全局命令码"><a href="#全局命令码" class="headerlink" title="全局命令码"></a><strong>全局命令码</strong></h2><blockquote>
<p>每一种操作对用一个命令码，用作标识指令。</p>
</blockquote>
<h4 id="全局命令码说明如下："><a href="#全局命令码说明如下：" class="headerlink" title="全局命令码说明如下："></a>全局命令码说明如下：</h4><table>
<thead>
<tr>
<th style="text-align:left">命令码（十六进制）</th>
<th style="text-align:left">十进制</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">0x0001</td>
<td style="text-align:left">1</td>
<td style="text-align:left">添加歌曲</td>
</tr>
<tr>
<td style="text-align:left">0x0002</td>
<td style="text-align:left">2</td>
<td style="text-align:left">App查询歌曲列表</td>
</tr>
<tr>
<td style="text-align:left">0x0003</td>
<td style="text-align:left">3</td>
<td style="text-align:left">升级操作</td>
</tr>
<tr>
<td style="text-align:left">0x0004</td>
<td style="text-align:left">4</td>
<td style="text-align:left">播放</td>
</tr>
<tr>
<td style="text-align:left">0x0005</td>
<td style="text-align:left">5</td>
<td style="text-align:left">关机</td>
</tr>
<tr>
<td style="text-align:left">0x0006</td>
<td style="text-align:left">6</td>
<td style="text-align:left">静音/解除静音</td>
</tr>
<tr>
<td style="text-align:left">0x0007</td>
<td style="text-align:left">7</td>
<td style="text-align:left">音量+</td>
</tr>
<tr>
<td style="text-align:left">0x0008</td>
<td style="text-align:left">8</td>
<td style="text-align:left">音量-</td>
</tr>
<tr>
<td style="text-align:left">0x0009</td>
<td style="text-align:left">9</td>
<td style="text-align:left">切换aux状态</td>
</tr>
<tr>
<td style="text-align:left">0x000a</td>
<td style="text-align:left">10</td>
<td style="text-align:left">下一曲</td>
</tr>
<tr>
<td style="text-align:left">0x000b</td>
<td style="text-align:left">11</td>
<td style="text-align:left">上一曲</td>
</tr>
<tr>
<td style="text-align:left">0x000c</td>
<td style="text-align:left">12</td>
<td style="text-align:left">暂停</td>
</tr>
<tr>
<td style="text-align:left">0x000d</td>
<td style="text-align:left">13</td>
<td style="text-align:left">App查询播放状态</td>
</tr>
<tr>
<td style="text-align:left">0x000e</td>
<td style="text-align:left">14</td>
<td style="text-align:left">WIFI 无线简易连接</td>
</tr>
<tr>
<td style="text-align:left">0x000f</td>
<td style="text-align:left">15</td>
<td style="text-align:left">设备回复心跳</td>
</tr>
<tr>
<td style="text-align:left">0x400f</td>
<td style="text-align:left">16399</td>
<td style="text-align:left">App发送心跳</td>
</tr>
<tr>
<td style="text-align:left">0x0011</td>
<td style="text-align:left">17</td>
<td style="text-align:left">palyMode(顺序播放/随机播放/列表循环/单曲循环/)</td>
</tr>
<tr>
<td style="text-align:left">0x0012</td>
<td style="text-align:left">18</td>
<td style="text-align:left">音量设置（直接设置音量值）</td>
</tr>
<tr>
<td style="text-align:left">0x0013</td>
<td style="text-align:left">19</td>
<td style="text-align:left">设备推送播放状态</td>
</tr>
<tr>
<td style="text-align:left">0x0014</td>
<td style="text-align:left">20</td>
<td style="text-align:left">设备推送播放列表</td>
</tr>
<tr>
<td style="text-align:left">0x0015</td>
<td style="text-align:left">21</td>
<td style="text-align:left">拖拽进度条</td>
</tr>
</tbody>
</table>
<h2 id="全局返回码"><a href="#全局返回码" class="headerlink" title="全局返回码"></a><strong>全局返回码</strong></h2><blockquote>
<p>每次调用接口时，可能获得正确或错误的返回码，可以根据返回码信息调试接口，排查错误。</p>
</blockquote>
<p>####全局返回码说明如下：<br>|0|    请求成功|<br>|:—–|:—|<br>|200|    无错误|<br>|400    |不支持此接口|<br>|401    |JSON数据解析错误|</p>
<h2 id="示例"><a href="#示例" class="headerlink" title="示例"></a><strong>示例</strong></h2><h3 id="字符串"><a href="#字符串" class="headerlink" title="字符串"></a><strong>字符串</strong></h3><pre><code>{ 
&quot;cmd&quot;: 0x0001 ,//命令码
&quot;code&quot;: 0,  //返回码
&quot;msg&quot;: &quot;&quot;,  //状态消息
&quot;data&quot;: &quot;This is string&quot;  //数据节点
}
</code></pre><h3 id="整形参数"><a href="#整形参数" class="headerlink" title="整形参数"></a><strong>整形参数</strong></h3><pre><code>{ 
&quot;cmd&quot;: 0x0001 ,//命令码
&quot;code&quot;: 0,  //返回码
&quot;msg&quot;: &quot;&quot;,  //状态消息
&quot;data&quot;: 1  //数据节点
}
</code></pre><h3 id="对象"><a href="#对象" class="headerlink" title="对象"></a><strong>对象</strong></h3><pre><code>{ 
&quot;cmd&quot;: 0x0001 ,//命令码
&quot;code&quot;: 0,  //返回码
&quot;msg&quot;: &quot;&quot;,  //状态消息
&quot;data&quot;:  {
      &quot;ssid&quot;:&quot;TP-link&quot;,  //连接的路由名称
      &quot;password&quot;:&quot;12345678&quot;,  //路由密码,需要加密
  }  
}
</code></pre><h3 id="数组"><a href="#数组" class="headerlink" title="数组"></a><strong>数组</strong></h3><pre><code>{ 
&quot;cmd&quot;: 0x001 ,//命令码
&quot;code&quot;: 0,  //返回码
&quot;msg&quot;: &quot;&quot;,  //状态消息
&quot;data&quot;:[
  {
        &quot;id&quot;      ：   &quot;0&quot;
        &quot;name&quot; ： “xxxx&quot;,
        &quot;artist&quot; ： “xxxx&quot;,
        &quot;album_title&quot;： “xxxx&quot;,
        &quot;cover_url_small”：“xxxx&quot;,
        &quot;cover_url_middle&quot;:&quot;xxxx&quot;,
        &quot;cover_url_large&quot;:&quot;xxxx&quot;,
        &quot;url&quot;:&quot;xxxxxxxxx&quot;  {详细规格见规格说明url部分},
  },
  {
        &quot;id&quot;:&quot;1&quot;
        &quot;name&quot;:&quot;xxxx1&quot;,
        &quot;artist&quot;:&quot;xxxx1&quot;,
        &quot;album&quot;:&quot;xxxx1&quot;,
        &quot;cover_url_small&quot;:&quot;xxxx&quot;,
        &quot;cover_url_middle&quot;:&quot;xxxx&quot;,
        &quot;cover_url_large&quot;:&quot;xxxx&quot;,
        &quot;url&quot;:&quot;xxxxxxxxxx&quot;{详细规格见规格说明url部分},
  }
   ]
}
</code></pre><h2 id="指令说明"><a href="#指令说明" class="headerlink" title="指令说明"></a><strong>指令说明</strong></h2><h3 id="一、设备基础指令"><a href="#一、设备基础指令" class="headerlink" title="一、设备基础指令"></a><strong>一、设备基础指令</strong></h3><ol>
<li><strong>App扫描设备</strong><br>|0x5A    |数据长度    |框架版本    |协议类型    |设备编码    |Mac地址    |数据帧序列号    |保留字    |数据类型    |数据内容    |检验码FCS|<br>|:—-|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|<br>|5A    |0022|    40|    01|    0000000000000000|    000000000000|    20000000|    0000000000000000    |0405|    data|    381a|</li>
</ol>
<ul>
<li><font color="#c00"><strong>命令字：0x0405</strong></font></li>
<li><font color="#c00"><strong>data区：NULL</strong></font>
</li>
</ul>
<ol start="2">
<li><strong>设备回复自身信息</strong><br>|0x5A    |数据长度    |框架版本    |协议类型    |设备编码    |Mac地址    |数据帧序列号    |保留字    |数据类型    |数据内容    |检验码FCS|<br>|:—-|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|<br>|5A    |xxxx    |    40|    01|    00000199001b0300    |    d8f710e019b0    |    00000000|    0000000000000000    |0305    |    data|    xxxx|</li>
</ol>
<ul>
<li><font color="#c00"><strong>命令字：0x0305</strong></font></li>
<li><font color="#c00"><strong>厂商ID：0x0199</strong> </font></li>
<li><font color="#c00"><strong>大分类：0x1b</strong>  </font></li>
<li><font color="#c00"><strong>小分类：0x03</strong></font> 
</li>
</ul>
<ol start="3">
<li><strong>App发送心跳包</strong><br>|0x5A    |数据长度    |框架版本    |协议类型    |设备编码    |Mac地址    |数据帧序列号    |保留字    |数据类型    |数据内容    |检验码FCS|<br>|:—-|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|<br>|5A    |xxxx    |    40|    01|    0000000000000000|    000000000000|    20000000|    0000000000000000    |0104|    data|    xxxx|</li>
</ol>
<ul>
<li><font color="#c00"><strong>命令字：0x0104</strong></font> </li>
<li><font color="#c00"><strong>data区：json</strong></font> 

</li>
</ul>
<p>示例：</p>
<pre><code>{ 
 &quot;cmd&quot;: 0x400f ,//命令码
&quot;code&quot;: 0,    //返回码
&quot;msg&quot;: &quot;&quot;,    //状态消息
&quot;data&quot;: ......    //数据节点
}
</code></pre><ol start="4">
<li><strong>设备回复心跳</strong><br>|0x5A    |数据长度    |框架版本    |协议类型    |设备编码    |Mac地址    |数据帧序列号    |保留字    |数据类型    |数据内容    |检验码FCS|<br>|:—-|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|:—–|<br>|5A    |xxxx    |    40|    01|    0000000000000000|    000000000000|    00000000|    0000000000000000    |0204|    data|    xxxx|</li>
</ol>
<ul>
<li><font color="#c00"> <strong>命令字：0x0204</strong></font> </li>
<li><font color="#c00"> <strong>data区：json</strong></font> 


</li>
</ul>
<p>示例：</p>
<pre><code>{ 
 &quot;cmd&quot;: 0x000f ,//命令码
&quot;code&quot;: 0,    //返回码
&quot;msg&quot;: &quot;&quot;,    //状态消息
&quot;data&quot;:  {
          &quot;deviceId&quot;: &quot;SPK设备序列号&quot;
      }  
}
</code></pre><h3 id="二、App主动控制终端指令"><a href="#二、App主动控制终端指令" class="headerlink" title="二、App主动控制终端指令"></a><strong>二、App主动控制终端指令</strong></h3><p><strong>1.App控制终端</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left">0x5A</th>
<th style="text-align:left">数据长度</th>
<th style="text-align:left">框架版本</th>
<th style="text-align:left">协议类型</th>
<th style="text-align:left">设备编码</th>
<th style="text-align:left">Mac地址</th>
<th style="text-align:left">数据帧序列号</th>
<th style="text-align:left">保留字</th>
<th style="text-align:left">数据类型</th>
<th style="text-align:left">数据内容</th>
<th style="text-align:left">检验码FCS</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">5A</td>
<td style="text-align:left">xxxx</td>
<td style="text-align:left">40</td>
<td style="text-align:left">01</td>
<td style="text-align:left">0000000000000000</td>
<td style="text-align:left">000000000000</td>
<td style="text-align:left">00000000</td>
<td style="text-align:left">0000000000000000</td>
<td style="text-align:left">0104</td>
<td style="text-align:left">data</td>
<td style="text-align:left">xxxx</td>
</tr>
</tbody>
</table>
<ul>
<li><font color="#c00"> <strong>命令字：0x0104</strong></font> </li>
<li><font color="#c00"> <strong>data区：json数据</strong></font> 

<p>示例：</p>
<pre><code>{ 
 &quot;cmd&quot;: 0x00xx ,//命令码
&quot;code&quot;: 0,    //返回码
&quot;msg&quot;: &quot;&quot;,    //状态消息
&quot;data&quot;: ......    //数据节点
}
</code></pre></li>
</ul>
<p><strong>2.终端回复App</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left">0x5A</th>
<th style="text-align:left">数据长度</th>
<th style="text-align:left">框架版本</th>
<th style="text-align:left">协议类型</th>
<th style="text-align:left">设备编码</th>
<th style="text-align:left">Mac地址</th>
<th style="text-align:left">数据帧序列号</th>
<th style="text-align:left">保留字</th>
<th style="text-align:left">数据类型</th>
<th style="text-align:left">数据内容</th>
<th style="text-align:left">检验码FCS</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">5A</td>
<td style="text-align:left">xxxx</td>
<td style="text-align:left">40</td>
<td style="text-align:left">01</td>
<td style="text-align:left">0000000000000000</td>
<td style="text-align:left">000000000000</td>
<td style="text-align:left">00000000</td>
<td style="text-align:left">0000000000000000</td>
<td style="text-align:left">0204</td>
<td style="text-align:left">data</td>
<td style="text-align:left">xxxx</td>
</tr>
</tbody>
</table>
<ul>
<li><font color="#c00"> <strong>命令字：0x0204</strong></font> </li>
<li><font color="#c00"> <strong>data区：json数据</strong></font> 

<p>示例：</p>
<pre><code>{ 
 &quot;cmd&quot;: 0x00xx ,//命令码
&quot;code&quot;: 0,    //返回码
&quot;msg&quot;: &quot;&quot;,    //状态消息
&quot;data&quot;: ......    //数据节点
}
</code></pre></li>
</ul>
<h3 id="三、终端主动发送控制数据给App"><a href="#三、终端主动发送控制数据给App" class="headerlink" title="三、终端主动发送控制数据给App"></a><strong>三、终端主动发送控制数据给App</strong></h3><p><strong>1.周期上传运行数据</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left">0x5A</th>
<th style="text-align:left">数据长度</th>
<th style="text-align:left">框架版本</th>
<th style="text-align:left">协议类型</th>
<th style="text-align:left">设备编码</th>
<th style="text-align:left">Mac地址</th>
<th style="text-align:left">数据帧序列号</th>
<th style="text-align:left">保留字</th>
<th style="text-align:left">数据类型</th>
<th style="text-align:left">数据内容</th>
<th style="text-align:left">检验码FCS</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">5A</td>
<td style="text-align:left">xxxx</td>
<td style="text-align:left">40</td>
<td style="text-align:left">01</td>
<td style="text-align:left">0000000000000000</td>
<td style="text-align:left">000000000000</td>
<td style="text-align:left">00000000</td>
<td style="text-align:left">0000000000000000</td>
<td style="text-align:left">0105</td>
<td style="text-align:left">data</td>
<td style="text-align:left">xxxx</td>
</tr>
</tbody>
</table>
<ul>
<li><font color="#c00"> <strong>命令字：0x0105</strong></font> </li>
<li><font color="#c00"> <strong>data区：json数据</strong></font> 

<p>示例：</p>
<pre><code>{ 
 &quot;cmd&quot;: 0x0013 ,//命令码
&quot;code&quot;: 0,    //返回码
&quot;msg&quot;: &quot;&quot;,    //状态消息
&quot;data&quot;: ......    //数据节点
}
</code></pre></li>
</ul>
<h1 id="音箱数据模型"><a href="#音箱数据模型" class="headerlink" title="音箱数据模型"></a><strong>音箱数据模型</strong></h1><h2 id="一、歌单"><a href="#一、歌单" class="headerlink" title="一、歌单"></a><strong>一、歌单</strong></h2><p><strong>参数说明</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left">参数名称</th>
<th style="text-align:left">是否必须</th>
<th style="text-align:left">字段类型</th>
<th style="text-align:left">参数说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">id</td>
<td style="text-align:left">是</td>
<td style="text-align:left">int</td>
<td style="text-align:left">歌曲ID</td>
</tr>
<tr>
<td style="text-align:left">name</td>
<td style="text-align:left">否</td>
<td style="text-align:left">string</td>
<td style="text-align:left">演唱者</td>
</tr>
<tr>
<td style="text-align:left">artist</td>
<td style="text-align:left">否</td>
<td style="text-align:left">String</td>
<td style="text-align:left">艺术家</td>
</tr>
<tr>
<td style="text-align:left">album_title</td>
<td style="text-align:left">否</td>
<td style="text-align:left">String</td>
<td style="text-align:left">专辑标题</td>
</tr>
<tr>
<td style="text-align:left">lrc_id</td>
<td style="text-align:left">否</td>
<td style="text-align:left">String</td>
<td style="text-align:left">歌词ID</td>
</tr>
<tr>
<td style="text-align:left">image_url_small</td>
<td style="text-align:left">否</td>
<td style="text-align:left">String</td>
<td style="text-align:left">歌曲海报1</td>
</tr>
<tr>
<td style="text-align:left">image_url_middle</td>
<td style="text-align:left">否</td>
<td style="text-align:left">String</td>
<td style="text-align:left">歌曲海报2</td>
</tr>
<tr>
<td style="text-align:left">image_url_large</td>
<td style="text-align:left">否</td>
<td style="text-align:left">String</td>
<td style="text-align:left">歌曲海报3</td>
</tr>
<tr>
<td style="text-align:left">mac</td>
<td style="text-align:left">否</td>
<td style="text-align:left">String</td>
<td style="text-align:left">Mac地址</td>
</tr>
<tr>
<td style="text-align:left">total_time</td>
<td style="text-align:left">否</td>
<td style="text-align:left">int</td>
<td style="text-align:left">歌曲时长</td>
</tr>
<tr>
<td style="text-align:left">album_id</td>
<td style="text-align:left">否</td>
<td style="text-align:left">int</td>
<td style="text-align:left">专辑ID</td>
</tr>
<tr>
<td style="text-align:left">utype</td>
<td style="text-align:left">否</td>
<td style="text-align:left">int</td>
<td style="text-align:left">比如 虾米音乐 考虑 喜马拉雅 之类的</td>
</tr>
<tr>
<td style="text-align:left">uri</td>
<td style="text-align:left">是</td>
<td style="text-align:left">int</td>
<td style="text-align:left">歌曲URL</td>
</tr>
<tr>
<td style="text-align:left">downloadurl</td>
<td style="text-align:left">是</td>
<td style="text-align:left">String</td>
<td style="text-align:left">下载url</td>
</tr>
</tbody>
</table>
<h2 id="二、播放状态"><a href="#二、播放状态" class="headerlink" title="二、播放状态"></a><strong>二、播放状态</strong></h2><p><strong>参数说明</strong><br>|参数名称|是否必须    |字段类型|参数说明|<br>|:—-|:—–|:—–|:—–|<br>|id    是    |int|    歌曲ID|<br>|mtype    |是    |String    |虾米，百度云盘，本地音乐…|<br>|p_status|    否    |int    |“0/1/2/3/4”, //准备播放，播放,暂停,停止,播放结束(用于网络收音机)|<br>|type|    否    |String|    当前播放源(预设preset),收藏,实时推送|<br>|name    |否    |string    |演唱者|<br>|artist    |否    |String|    艺术家|<br>|album|    否    |String|    专辑|<br>|next_id|    是|    int|    下一首歌曲id|<br>|total_time|    是|    int|    歌曲总时间|<br>|current_time|    是|    int|    歌曲当前播放时间|<br>|play_mode|    否|    int|    模式（//顺序播放/随机播放列表循环/单曲循环/）|<br>|volume    |是    |int|    音量|</p>
<h1 id="绑定流程"><a href="#绑定流程" class="headerlink" title="绑定流程"></a><strong>绑定流程</strong></h1><p><img src="http://img.blog.csdn.net/20160226142156953" alt="这里写图片描述"><br><strong><em><a href="http://img.blog.csdn.net/20160226142156953" target="_blank" rel="noopener">点击看大图</a></em></strong></p>
<p><a href="http://blog.csdn.net/xxl6097/article/details/50127949" target="_blank" rel="noopener"><strong>[原文链接地址]http://blog.csdn.net/xxl6097/article/details/50127949</strong></a></p>

                
<p class="pink-link-context">
    <a href="/2016/05/11/android-ndk-so-a/" rel="next" title="Android导入第三方静态库.a编译成动态库.so">
    上一篇：Android导入第三方静态库.a编译成动态库.so
  </a>
</p>



<p class="pink-link-context">
    <a href="/2016/05/11/public-bind/" rel="next" title="绑定界面动资源画动态替换">
    下一篇：绑定界面动资源画动态替换
  </a>
</p>


            </div>
			
        </div>
    </div>
</article>




    <section id="comment">
        <div class="card">
            <div class="card-content">
                <!-- Duoshuo Comment BEGIN -->
                <div class="ds-thread" data-thread-key="2016/05/11/ximalaya/" data-title="喜马拉雅WiFi音响绑定及通讯协议初稿" data-url="http://uuxia.cn/2016/05/11/ximalaya/"></div>

                <script type="text/javascript">
                    console.log(document.querySelector('.ds-thread'));
                    var duoshuoQuery = {
                        short_name: 'uuxia'
                    };
                    (function() {
                        var ds = document.createElement('script');
                        ds.type = 'text/javascript';
                        ds.async = true;
                        ds.src = (document.location.protocol == 'https:'
                            ? 'https:'
                            : 'http:') + '//static.duoshuo.com/embed.js';
                        ds.charset = 'UTF-8';
                        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ds);
                    })();
                </script>
                <!-- Duoshuo Comment END -->
            </div>
        </div>
    </section>




</div>

        <div class="fixed-action-btn float-sitemap">
    <a class="btn-floating btn-large pink">
      <i class="fa fa-caret-square-o-up"></i>
    </a>
    <ul>
      <li><a class="btn-return-top btn-floating waves-effect green" title="回到顶部"><i class="fa fa-arrow-circle-o-up"></i></a></li>
      <li><a class="btn-floating waves-effect button-collapse yellow darken-1"  data-activates="main-menu" title="菜单"><i class="fa fa-navicon"></i></a></li>
    </ul>
  </div>

    </main>
    <footer class="page-footer indigo darken-1">
    
    <div class="footer-container container">
        <div class="row">
            
            <div class="social-group col m4 s12">
                <h5 class="white-text">社交</h5>
                
                    <a class="social-link" href="http://weibo.com/" target="_blank">
                        <i class="fa fa-2x fa-weibo"></i>
                    </a>
                
                    <a class="social-link" href="https://github.com/xxl6097" target="_blank">
                        <i class="fa fa-2x fa-github"></i>
                    </a>
                
                    <a class="social-link" href="/atom.xml" target="_blank">
                        <i class="fa fa-2x fa-rss"></i>
                    </a>
                
                
    <script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
    </script>
    <div class="site-visitors-container white-text">
        <span>
            <i class="fa fa-user"></i>
            <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
        </span>
        <span>&nbsp;|&nbsp;</span>
        <span>
            <i class="fa fa-eye"></i>
            <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
        </span>
    </div>


            </div>
            

            
            <div class="col m8 s12">
                <h5 class="white-text">友情链接</h5>
                
                    <a class="social-link" href="http://raytaylorlin.com/" target="_blank">raytaylorism主题作者的技术博客</a>
                
                    <a class="social-link" href="https://github.com/xxl6097" target="_blank">Github地址（测试友情链接）</a>
                
            </div>
            
        </div>
    </div>
    
    <div style="width:300px;margin:0 auto; padding:20px 0;">
        <a target="_blank" href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030502001748" style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="" style="float:left;"/><p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">粤公网安备 44030502001748号</p></a>
    </div>
    <div class="footer-copyright pink-link-context">
        <div class="container">
            © 2018 uuxia.cn, All rights reserved.
            <p class="right" style="margin-top: 0;">本博客由 <a href="https://hexo.io">Hexo</a> 强力驱动 | 主题 <a href="https://github.com/raytaylorlin/hexo-theme-raytaylorism">raytaylorism</a></p>
        </div>
    </div>

</footer>


    <noscript>
    <div class="noscript">
        <p class="center-align">当前网速较慢或者你使用的浏览器不支持博客特定功能，请尝试刷新或换用Chrome、Firefox等现代浏览器</p>
    </div>
</noscript>
<div class="noscript">
    <p class="center-align">当前网速较慢或者你使用的浏览器不支持博客特定功能，请尝试刷新或换用Chrome、Firefox等现代浏览器</p>
</div>


<script src="/js/jquery.min.js"></script>
<script src="/js/materialize.min.js"></script>

<script>
    (function($) {
        $(document).ready(function() {
            // 隐藏禁用javascript（针对微信内置浏览器）的提示
            $('.noscript').hide();

            // 图片缩放效果
            var $imgs = $('img').not('.slider-image').not('.avatar-image').not('.carousel-image').not('.card-cover-image').not('.qrcode');

            // 给图片加上点击放大效果（materialbox插件）
            $imgs.addClass('materialboxed').each(function(i, el) {
                $(this).attr('data-caption', $(this).attr('alt') || ' ');
            }).materialbox();

            // 优化表格的显示
            $('table').each(function() {
                var $table = $(this);
                // 除去多行代码的情况
                if ($table.find('pre').length == 0) {
                    $table.addClass('responsive-table striped bordered');
                }
            });

            // 首页幻灯片
            $('.slider').slider({indicators: true, full_width: true, interval: 8000});

            $(".button-collapse").sideNav();
            $(".category-menu").sideNav();

            // 针对gallery post
            $('.carousel').carousel({full_width: true});
            $('.carousel-control.prev').click(function() {
                $('.carousel').carousel('prev');
            });
            $('.carousel-control.next').click(function() {
                $('.carousel').carousel('next');
            });

            // 文章目录
            $('article').not('.simple-article').find('h1').add('h2').add('h3').add('h4').add('h5').add('h6').scrollSpy();

            // 目录随屏幕滚动（防止目录过长越过footer）
            var $toc = $('.toc');
            var scrollTargetTop = 0;
            $(window).scroll(function() {
                var $activeLink = $toc.find('a.active.section');
                if ($(window).scrollTop() < 100) {
                    scrollTargetTop = 0;
                } else {
                    if ($activeLink[0]) {
                        scrollTargetTop = $activeLink.offset().top - $toc.offset().top;
                    }
                }
                $toc.css('top', '-' + scrollTargetTop + 'px');
            });

            // 修正文章目录的left-border颜色
            var color = $('.table-of-contents-text').css('color');
            $('.table-of-contents-link').css('border-left-color', color);

            // 针对移动端做的优化：FAB按钮点击一下收回
            if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                $('.fixed-action-btn').addClass('click-to-toggle');
            }
            // 回到顶部
            $('.btn-return-top').click(function() {
                $('body, html').animate({
                    scrollTop: 0
                }, 500);
            });

            // 重置读书页面的Tab标签页的颜色
            $('li.tab a').hover(function() {
                $(this).toggleClass('text-lighten-4');
            });
            $('.indicator').addClass('pink lighten-2');

            
            // 添加new标签
            $('.menu-reading, .menu-about').append('<span class="new badge pink"></span>');
            

            // 搜索功能
            $('.modal-trigger').leanModal({
                // 打开搜索框时自动聚焦
                ready: function() {
                    if ($('#search').is(":visible")) {
                        $('#search-input').focus();
                    }
                }
            });
            var searchXml = "search.xml";
            if (searchXml.length == 0) {
             	searchXml = "search.xml";
            }
            var searchPath = "/" + searchXml;
            initSearch(searchPath, 'search-input', 'search-result');
        });

        // 初始化搜索与匹配函数
        var initSearch = function(path, search_id, content_id) {
            'use strict';
            $.ajax({
                url: path,
                dataType: "xml",
                success: function(xmlResponse) {
                    // get the contents from search data
                    var datas = $("entry", xmlResponse).map(function() {
                        return {
                            title: $("title", this).text(),
                            content: $("content", this).text(),
                            url: $("url", this).text()
                        };
                    }).get();
                    var $input = document.getElementById(search_id);
                    var $resultContent = document.getElementById(content_id);
                    $input.addEventListener('input', function() {
                        var str = '<ul class=\"search-result-list\">';
                        var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                        $resultContent.innerHTML = "";
                        if (this.value.trim().length <= 0) {
                            return;
                        }
                        // perform local searching
                        datas.forEach(function(data) {
                            var isMatch = true;
                            var content_index = [];
                            var data_title = data.title.trim().toLowerCase();
                            var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                            var data_url = data.url;
                            var index_title = -1;
                            var index_content = -1;
                            var first_occur = -1;
                            // only match artiles with not empty titles and contents
                            if (data_title != '' && data_content != '') {
                                keywords.forEach(function(keyword, i) {
                                    index_title = data_title.indexOf(keyword);
                                    index_content = data_content.indexOf(keyword);
                                    if (index_title < 0 && index_content < 0) {
                                        isMatch = false;
                                    } else {
                                        if (index_content < 0) {
                                            index_content = 0;
                                        }
                                        if (i == 0) {
                                            first_occur = index_content;
                                        }
                                    }
                                });
                            }
                            // show search results
                            if (isMatch) {
                                keywords.forEach(function(keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    data_title = data_title.replace(regS, "<span class=\"search-keyword pink lighten-2\">" + keyword + "</span>");
                                });

                                str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                                var content = data.content.trim().replace(/<[^>]+>/g, "");
                                if (first_occur >= 0) {
                                    // cut out 100 characters
                                    var start = first_occur - 20;
                                    var end = first_occur + 80;
                                    if (start < 0) {
                                        start = 0;
                                    }
                                    if (start == 0) {
                                        end = 100;
                                    }
                                    if (end > content.length) {
                                        end = content.length;
                                    }
                                    var match_content = content.substring(start, end);
                                    // highlight all keywords
                                    keywords.forEach(function(keyword) {
                                        var regS = new RegExp(keyword, "gi");
                                        match_content = match_content.replace(regS, "<span class=\"search-keyword pink lighten-2\">" + keyword + "</span>");
                                    });

                                    str += "<p class=\"search-result\">..." + match_content + "...</p>"
                                }
                                str += "</li>";
                            }
                        });
                        str += "</ul>";
                        $resultContent.innerHTML = str;
                    });
                }
            });
        }
    })(jQuery);
</script>


<script src="/js/prettify.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $("pre").addClass("prettyprint");
        prettyPrint();
    });
</script>




<script type="text/javascript" src="http://tajs.qq.com/stats?sId=56133145" charset="UTF-8"></script>



<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript" async
  src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>



</body>
</html>
